#include <queue>
#include <map>
#include <vector>
#include <iostream>
#include <cstdio>
int abs(int n) {
 	return (n >= 0 ? n : -n);
}

enum direction {up, down, left, right};

direction next(direction d) {
	direction d1;
	switch(d) {
	case up: d1 = down; break;
	case down: d1 = left; break;
	case left: d1 = right; break;
	case right: d1 = up; break;
	}
	return d1;
}

class fifteen {
private:
	std::vector<char> cell;
	int freeCell;
public:
	fifteen() {
	    cell.resize(16);
		for (int i=0; i<15; i++) cell[i] = i+1;
		cell[15] = 0;
		freeCell = 15;
	}

	fifteen(const std::vector<int>& array) {
		cell.resize(16);
		for (int i=0; i<16; i++) {
			cell[i] = array[i];
			if (!cell[i]) {
				freeCell = i;
			}
		}
	}

	int imperfection() const {
		int imp = 0;
		for (int i=0; i<16; i++) {
			if (cell[i]) {
				imp += abs(i/4 - (cell[i]-1)/4) + abs(i%4 - (cell[i]-1)%4);
			} else {
				imp += abs(i/4 - 3) + abs(i%4 - 3);
			}
		}
		return imp;
	}

	bool operator < (const fifteen& operand) const {
		int imp1 = imperfection();
		int imp2 = operand.imperfection();
		if (imp1 != imp2) {
            return imperfection() > operand.imperfection();
		}
		else {
            return cell > operand.cell;
		}
	}

	bool canMove(direction d) const {
		if (d == up) return (freeCell < 12);
		else if (d == down) return (freeCell > 3);
		else if (d == left) return (freeCell % 4 != 3);
		else return (freeCell % 4);
	}

	fifteen moved(direction d) const {
		fifteen moved = *this;
		if (d == up) {
			moved.cell[freeCell] = cell[freeCell+4];
			moved.cell[freeCell+4] = 0;
			moved.freeCell += 4;

		} else if (d == down) {
			moved.cell[freeCell] = cell[freeCell-4];
			moved.cell[freeCell-4] = 0;
			moved.freeCell -= 4;

		} else if (d == left) {
			moved.cell[freeCell] = cell[freeCell+1];
			moved.cell[freeCell+1] = 0;
			moved.freeCell += 1;

		} else {
			moved.cell[freeCell] = cell[freeCell-1];
			moved.cell[freeCell-1] = 0;
			moved.freeCell -= 1;

		}

		return moved;
	}

    void move(direction d) {
        *this = moved(d);
    }

};



int main() {

std::vector<int> begin_position;
for (int i=0; i<16; i++) {
	int k;
	std::cin >> k;
	begin_position.push_back(k);
}


;


fifteen current(begin_position);
std::priority_queue<fifteen> positions;
std::map<fifteen,char> used;
positions.push(current);
used.insert(std::make_pair(current, 0));

int count = 0;
while (current.imperfection()) {

	positions.pop();

	direction d = up;
	for (int i=0; i<4; i++) {
		if (current.canMove(d)) {
			fifteen newpos = current.moved(d);
			if (used.find(newpos) == used.end()) {
				positions.push(newpos);
				used.insert(std::make_pair(newpos,
									  d == up ? 'U' :
									  d == down ? 'D' :
									  d == left ? 'L' : 'R'));
			}
		}
		d = next(d);
	}

    current = positions.top();

    count++;
    if (count % 1000 == 0) {
        std::cout << positions.size() << ' '<< used.size()<<'\n';
    }
}

char step;
std::vector<char> answer;

while (step = used[current]) {
	answer.push_back(step);
    if (step == 'D') current.move(up);
    else if (step == 'U') current.move(down);
    else if (step == 'R') current.move(left);
    else current.move(right);
}

for (int i = answer.size()-1; i >= 0; i--)
	std::cout << answer[i];

std::cout << '\n' << answer.size();


return 0;

}
